package com.baosight.sczx.common.zm.cInterface.cs;

import java.util.HashMap;
import java.util.List;

import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;
import com.baosight.sczx.common.zm.cInterface.CmesConstants;
import com.baosight.sczx.zm.cs.domain.ZMCSSystemSettingCM;

/**
 * 系统设置-材料消耗管理
 * <p>Title: SystemSettingCD.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 严洪浩
 * @version 1.0
 * <pre>Histroy:
 *          2011-1-18 下午07:46:38  严洪浩  Create
 *</pre>
 */
public class SystemSettingCM {
	
	private static Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	private static SystemSettingCM instance = new SystemSettingCM();
	private static ZMCSSystemSettingCM systemSetting;
	
	private SystemSettingCM(){
		initData();//当第一次使用的时候初始化
	}
	
	@SuppressWarnings("unchecked")
	private void initData(){
		List<ZMCSSystemSettingCM> _list = dao.query("ZMCSSystemSettingCM.query", new HashMap<String, String>());
		if(_list.size() < 1) {
			systemSetting = null;
		}
		else {
			systemSetting = _list.get(0);
		}
		CmesConstants.SYSTEMSETTING_CM = 0;
	}
	
	/**
	 * 计划开始日期
	 * <p>Function: getInventoryNo</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-7-18上午02:34:01 严洪浩
	 * </p>
	 *
	 */
	public String getPlanBeginDate(){
		String _temp = new String("10-10");
		if(systemSetting != null) {
			_temp = systemSetting.getFdPlanBeginDate();
		}
		
		return _temp.toString();
	}
	
	 /**
	 * 
	 * <p>Function: getIsusePlanPrice</p>
	 * <p>Description: 使用计划价</p>
	 * <p>return value:String</p>
	 * <p>History:
	 *    2012-3-1上午10:29:14 wangkun
	 * </p>
	 *
	 */
	public String getIsusePlanPrice(){
		String _temp = new String("0");//是否使用 0否 1是
		if(systemSetting != null) {
			_temp = systemSetting.getFdIsusePlanPrice();
		}
		
		return _temp.toString();
	}

	/**
	 * 盘点单号形式
	 * <p>Function: getSystemModel</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午07:58:20 严洪浩
	 * </p>
	 *
	 */
	public String getInventoryNo(){
		String _temp = new String("0");//默认为 0自动 1手动 2生成
		if(systemSetting != null) {
			_temp = systemSetting.getFdInventoryNo();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 盘点单号 规则
	 * <p>Function: getMiningType</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:17:55 严洪浩
	 * </p>
	 *
	 */
	public String getInventoryNoRule(){
		String _temp = new String("0");
		if(systemSetting != null) {
			_temp = systemSetting.getFdInventoryNoRule();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 领料申请单号形式
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public String getApplicationNo(){
		String _temp = new String("0");//默认为 0自动 1手动 2生成
		if(systemSetting != null) {
			_temp = systemSetting.getFdApplicationNo();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 领料申请单号规则
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public String getApplicationNoRule(){
		String _temp = new String("0");
		if(systemSetting != null) {
			_temp = systemSetting.getFdApplicationNoRule();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 入库单号形式
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public String getImportNo(){
		String _temp = new String("0");//默认为 0自动 1手动 2生成
		if(systemSetting != null) {
			_temp = systemSetting.getFdImportNo();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 入库单号规则
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public String getImportNoRule(){
		String _temp = new String("0");
		if(systemSetting != null) {
			_temp = systemSetting.getFdImportNoRule();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 出库单号形式
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public String getExportNo(){
		String _temp = new String("0");//默认为 0自动 1手动 2生成
		if(systemSetting != null) {
			_temp = systemSetting.getFdExportNo();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 出库单号规则
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public String getExportNoRule(){
		String _temp = new String("0");
		if(systemSetting != null) {
			_temp = systemSetting.getFdExportNoRule();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 是否自动结转
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public String getIsAutoBase(){
		String _temp = new String("0");//自动结转 0否 1是
		if(systemSetting != null) {
			_temp = systemSetting.getFdIsAutoBase();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 自动结转日期
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public Long getAutoBaseDate(){
		Long _temp = new Long(0);
		if(systemSetting != null) {
			_temp = systemSetting.getFdAutoBaseDate();
		}
		
		return _temp;
	}
	
	/**
	 * 是否使用二级库
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public String getIsUseTwolvl(){
		String _temp = new String("0");//自动结转 0否 1是
		if(systemSetting != null) {
			_temp = systemSetting.getFdIsUseTwolvl();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 审核单位ID
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public String getDepartmentId(){
		String _temp = new String("NULL");
		if(systemSetting != null) {
			if(systemSetting.getFdDepartmentId()!=null)
			_temp = systemSetting.getFdDepartmentId();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 月度计划份数
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public Long getMonthPlan(){
		Long _temp = new Long(0);
		if(systemSetting != null) {
			_temp = systemSetting.getFdMonthPlan();
		}
		
		return _temp;
	}
	
	/**
	 * 月度计划截止日期
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public Long getMonthPlanDate(){
		Long _temp = new Long(0);
		if(systemSetting != null) {
			_temp = systemSetting.getFdMonthPlanDate();
		}
		
		return _temp;
	}
	
	/**
	 * 中旬计划份数
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public Long getMiddlePlan(){
		Long _temp = new Long(0);
		if(systemSetting != null) {
			_temp = systemSetting.getFdMiddlePlan();
		}
		
		return _temp;
	}
	
	/**
	 * 中旬计划截止日期
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public Long getMiddlePlanDate(){
		Long _temp = new Long(0);
		if(systemSetting != null) {
			_temp = systemSetting.getFdMiddlePlanDate();
		}
		
		return _temp;
	}
	
	/**
	 * 急用计划份数
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public Long getUrgentPlan(){
		Long _temp = new Long(0);
		if(systemSetting != null) {
			_temp = systemSetting.getFdUrgentPlan();
		}
		
		return _temp;
	}
	
	/**
	 * 急用计划截止日期
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public Long getUrgentPlanDate(){
		Long _temp = new Long(0);
		if(systemSetting != null) {
			_temp = systemSetting.getFdUrgentPlanDate();
		}
		
		return _temp;
	}
	
	/**
	 * 需求计划流程是否审批
	 * <p>Function: getIsApprover</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-9-19下午01:18:36 高强
	 * </p>
	 *
	 */
	public String getIsApprover(){
		String _temp = new String("1");//是否审批 0否 1是
		if(systemSetting != null) {
			_temp = systemSetting.getFdIsApprover();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 
	 * <p>Function: getIsuseTypemanagement</p>
	 * <p>Description: 使用材料分管</p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-11-7上午10:26:35 bobswang
	 * </p>
	 *
	 */
	public String getIsuseTypemanagement(){
		String _temp = new String("1");//是否使用 0否 1是
		if(systemSetting != null) {
			_temp = systemSetting.getFdIsuseTypemanagement();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 
	 * <p>Function: getIsuseNoplanApplication</p>
	 * <p>Description: 使用无计划领料</p>
	 * <p>return value:String</p>
	 * <p>History:
	 *    2012-3-1上午10:29:14 wangkun
	 * </p>
	 *
	 */
	public String getIsuseNoplanApplication(){
		String _temp = new String("0");//是否使用 0否 1是
		if(systemSetting != null) {
			_temp = systemSetting.getFdIsuseNoplanApplication();
		}
		
		return _temp.toString();
	}
	
	/**
	 * 得到对象的唯一句柄
	 * <p>Function: getInstance</p>
	 * <p>Description: </p>
	 * <p>return value:SystemSettingCD</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午07:50:20 严洪浩
	 * </p>
	 *
	 */
	public static SystemSettingCM getInstance(){
//		if(CmesConstants.SYSTEMSETTING_CM == 1) {
			instance = new SystemSettingCM();
//		}
		
		return instance;
	}
}
